﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117672022";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDjDHHzkDdhlFZ6CfFTw3UwNhwDX9M9TsrihEtaBfmUrzXiTeehW/WnHFUvBqO4BSvLtyd+4HZGV6mZLjUK6RrdldyadMJ/tc6+zgjYvQtHzT5VZ4g2EYlhzM7mhbS3jAK3CLITOjnE+/d5+Ed8oFlZq9rfy60QD+oyUDNc+Us4XnI5ETWROS+Pb0Bj/Bf1sAeP76ClOd7cluC7IwQSYWSdvxYMOEWnY62avBsTsj4W3AbpL72SlOP9/M0LnYsbYH7YKD7AqF8Dd/uUBVOTqVA+a576SG0vEF1RwwdpNqB0zewYgvLVlcz65LciPfFOVWTv6I1DxpXTdRCIaElgnh3zAgMBAAECggEATo11t0DECFyb9qkN917+Ymm2E2zJ1sI161y9/S1oBgsAZ4VwiCEawnBJAHYZmocfeeGqJnleMkQOB1M3QskXZGZ+5mlTCYBLQTRjVylAh9z4ne+t7pbuowmK47KKrZ4hKlY11fUlG4PZQTem8/U+NIoCtb7v50i6TCH3Q0l0vtE3eAH87ZDeDyoNQtH08VeNgQLiUw493S2re/37pq+IfR34s1eK/poJBFwTDkGoP3jJO+B84tA5VD54CL7/ogR1Pu+pK/QD+P6xjOM5Xwf+1gNJ+naytTkJPkszSnonPwRN6Z2O1wwNdcIJvYr0DtqXq+KXmLgl7mHMofNy5uvYIQKBgQD0r6mpZ4XjnlbnssEtdgCX9MP6kp/tIzIjMtu9xVpWY/LVludxl9XkZI2aUavoV8QSqXn8Pa9exaoj6X6vLYhnvz6gvjeH35VNGNmUiFpeeXisl0R+43dIh3A+VkL3Bd8DI2tAb8707PxXZVbqoHpL74n0SxJrXiiyNdh8/L6a+wKBgQDtjAHmckzleBrwPuOe7aYZuXhAMC0Mcai/I6+3Jx+WeMVYFe5fKFvRla/JDu1mYDgrSy8qDBsO5AILKnyFQIMJQxVgurARXW/OZIk6d/mXCgAFcqgDYwRs+fbRaPgF6V9DH7s5CnMKWB1DoR683T7x0XGA7jqmiM+wC7OrfEwXaQKBgE5/gH2hgZmpdZX1ifXssnoNg0YC/h2UugQCz+5MvxOSExikxfFyVaNlAuysIOt0JKocBs9+dqF/5nqI8SSABg/Kkev9ulDz0LEgNMVrDRrb+3PbP5U5ok35bXACOo+HKamXFlRgylNXKAldsImrHDD6Uxa1ct5RIdsyXRaT+w47AoGBAN6YZ99uFCijV3rxM5Ll1tQcPFbJzizvBNW3txzFiJAUM7jLNEfvJbtLrSGW31cjqv7GwTeBiIl3l4KnGXA0d5XiStINnpdnGzIoe39SlYu3TzXLry0dSDRmN6cb2e6QNThNL7/PzuVOlH2fKZKJMEahoN7UXhlX8mZhUMfM/fChAoGBALSJ5a7NgxGISFOKO+km3k1ueyyjE92wwpzYxviCI34BD5qf+f31ahKu4GRuJqzLJZ8eMPfzvRUzUECEyB7cYW8hbCvgMd3/66tHR4C/GnEQu01Rxtn3KLBkuSXy1CmlAHrWgxM1442YpKjBUtsmLTcWWP7RYTDqq+Hq02GirGMk";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwzv/Msdo8ROI9lvRHn+ZVfX5z00ZPqVt2L/Aa1jR2zmfhO6pa0uoNH7UqfjSUoOC2r5BkJfU566pvGeXqe29Dc5ZlA4MlUFva+kjSxymyO+3ZeX7d27VctZsCGysliHzv3yW2H56uqvVC5vqtkDec8hSugoIsPz7fRCmeRvRVg3QIsVUbcKIBUEPvxknLrP9D2Bk0kTFCNzmNEVD9XSvJcmNRY54zA1vvuPSfvuvtcryO5HxwTxDRARv5GiG7NDYnvUJzhyTgLSbseVFQl3L1zhn2HWCSA3+EQXY6bNzS4E/0BkuSt0jpohtVOx+pUWv1wvwtIPZ3qvK6lNoHAKyqQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 沙箱网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

